<template>
  <div>
    <input type="text" placeholder="Please input sth." v-model="inputRef" />
    <button @click="addTodo">Add</button>
  </div>
</template>

<script setup>
import { ref } from 'vue';
import { useStore } from '@/my-vuex';

const inputRef = ref('');
const store = useStore();
const addTodo = () => {
  store.dispatch('addTodo', inputRef.value);
  inputRef.value = '';
};
</script>
